/** * Name: early.js * URL: http://qsf.ec.quoracdn.net/-3-early.js87638378650afa98.js * Generated: 1481675091183240 * Files: /shared/loader.js, /shared/polyfills/requestAnimationFrame.js, /shared/polyfills/string.js, /shared/polyfills/classList.js, /shared/polyfills/array.js, /shared/polyfills/function.js, /shared/polyfills/object.js, /shared/polyfills/date.js, /shared/polyfills/es6-promise.js, /shared/polyfills.js, /third_party/tracekit.js, /shared/basicrpc.js, /shared/errors.js, /shared/w2.timing.js, /iesux.js, /domain.js, /redirect.js, /shared/links.js, /shared/onload.js, /third_party/fontfaceobserver.js, /shared/webfont.js, /early.js */ (function(e){function t(e){this.name="RequireError";this.message="Failed to call require('"+e+"')";this.stack=(new Error).stack;this.id=e}t.prototype=Object.create(Error.prototype);t.prototype.constructor=t;var n;var r;var i;var o;var a;var s;var l;var u;function f(){n={};r={};i={};o={};a={};s={};l={};u={}}f();function require(e){if(!n[e]){if(!r[e]){throw new t(e)}var i={};var exports=n[e]=i.exports={};r[e].call(window,require,exports,i);if(i.exports&&i.exports!==exports){n[e]=i.exports}}a[e]=true;return n[e]}function c(e){if(n[e]){return true}if(!r[e]){return false}var t=r[e];if(typeof t==="object"||i[e]||o[e]){return true}var a;var s={};var u=l[e];for(var f in u){if(!u.hasOwnProperty(f)){continue}o[e]=true;if(c(f)){s[f]=1}else{a=1;o[e]=null;break}o[e]=null}for(f in s){if(s.hasOwnProperty(f)){delete u[f]}}i[e]=!a;return!a}function d(e){if(c(e)){return null}if(!r[e]){return e}var t=l[e];var n;for(var i in t){if(t.hasOwnProperty(i)){n=d(i);if(n){return n}delete t[i]}}return null}var h=function(e,t,i){ l[e]=i||{};var o=typeof t==="object"?n:r;if(!o[e]){o[e]=t}if(s[e]){for(var a=0;an.length){t=n.length}t-=e.length;var r=n.indexOf(e,t);return r!==-1&&r===t}}if(!String.prototype.startsWith){String.prototype.startsWith=function(e,t){t=t||0;return this.substr(t,e.length)===e}}if(!String.prototype.trim){String.prototype.trim=function(){return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}}if(!String.prototype.includes){String.prototype.includes=function(e,t){ "use strict";if(typeof t!=="number"){t=0}if(t+e.length>this.length){return false}else{return this.indexOf(e,t)!==-1}}}});define("shared/polyfills/classList",[],function n(require,exports,e){(function(){if(typeof window.Element==="undefined"||"classList"in document.documentElement)return;var e=Array.prototype,t=e.push,n=e.splice,r=e.join;function i(e){this.el=e;var n=e.className.replace(/^\s+|\s+$/g,"").split(/\s+/);for(var r=0;r>>0;if(typeof e!=="function"){throw new TypeError}if(arguments.length>1){n=t}r=0;while(r>>0;var r=arguments.length>=2?arguments[1]:void 0;for(var i=0;i>>0;if(i===0){return-1}var o=+t||0;if(Math.abs(o)===Infinity){o=0}if(o>=i){return-1}n=Math.max(o>=0?o:i-Math.abs(o),0);while(n>>0;if(typeof e!=="function"){throw new TypeError(e+" is not a function")}if(arguments.length>1){n=t}r=0;while(r>>0;if(typeof e!=="function"){throw new TypeError(e+" is not a function")}if(arguments.length>1){n=t}r=new Array(a);i=0;while(i>>0;if(typeof e!=="function"){throw new TypeError}var r=[];var i=arguments.length>=2?arguments[1]:void 0;for(var o=0;o>>0,r=0,i;if(arguments.length==2){i=arguments[1]}else{while(r=n){throw new TypeError("Reduce of empty array with no initial value")}i=t[r++]}for(;r>>0;if(i===0){return-1}t=i-1; if(arguments.length>1){t=Number(arguments[1]);if(t!=t){t=0}else if(t!==0&&t!=1/0&&t!=-(1/0)){t=(t>0||-1)*Math.floor(Math.abs(t))}}for(n=t>=0?Math.min(t,i-1):i-Math.abs(t);n>=0;n--){if(n in r&&r[n]===e){return n}}return-1}}if(!Array.prototype.includes){Array.prototype.includes=function(e){"use strict";if(this==null){throw new TypeError("Array.prototype.includes called on null or undefined")}var t=Object(this);var n=parseInt(t.length,10)||0;if(n===0){return false}var r=parseInt(arguments[1],10)||0;var i;if(r>=0){i=r}else{i=n+r;if(i<0){i=0}}var o;while(i=0;--n){if(e[n]===t){e.splice(n,1)}}}function f(t,n){var i=null;if(n&&!r.collectWindowErrors){return}for(var a in e){if(s(e,a)){try{e[a].apply(null,[t].concat(o.call(arguments,2)))}catch(l){i=l}}}if(i){throw i}}var c,d;function h(e,t,n,i,o){ var s=null;if(a){r.computeStackTrace.augmentStackTraceWithInitialElement(a,t,n,e);v()}else if(o){s=r.computeStackTrace(o);f(s,true)}else{var l={url:t,line:n,column:i};l.func=r.computeStackTrace.guessFunctionName(l.url,l.line);l.context=r.computeStackTrace.gatherContext(l.url,l.line);s={mode:"onerror",message:e,stack:[l]};f(s,true)}if(c){return c.apply(this,arguments)}return false}function p(){if(d===true){return}c=t.onerror;t.onerror=h;d=true}function v(){var e=a,t=n;n=null;a=null;i=null;f.apply(null,[e,false].concat(t))}function m(e){if(a){if(i===e){return}else{v()}}var s=r.computeStackTrace(e);a=s;i=e;n=o.call(arguments,1);t.setTimeout(function(){if(i===e){v()}},s.incomplete?2e3:0);throw e}m.subscribe=l;m.unsubscribe=u;return m}();r.computeStackTrace=function d(){var e=false,n={};function i(e){if(!r.remoteFetching){return""}try{var n=function(){try{return new t.XMLHttpRequest}catch(e){return new t.ActiveXObject("Microsoft.XMLHTTP")}};var i=n();i.open("GET",e,false);i.send("");return i.responseText; }catch(o){return""}}function o(e){if(typeof e!=="string"){return[]}if(!s(n,e)){var r="";var o="";try{o=t.document.domain}catch(a){}var l=/(.*)\:\/\/([^:\/]+)([:\d]*)\/{0,1}([\s\S]*)/.exec(e);if(l&&l[2]===o){r=i(e)}n[e]=r?r.split("\n"):[]}return n[e]}function u(e,t){var n=/function ([^(]*)\(([^)]*)\)/,r=/['"]?([0-9A-Za-z$_]+)['"]?\s*[:=]\s*(function|eval|new Function)/,i="",s=10,u=o(e),f;if(!u.length){return a}for(var c=0;c0?i:null}function c(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#]/g,"\\$&")}function d(e){return c(e).replace("<","(?:<|<)").replace(">","(?:>|>)").replace("&","(?:&|&)").replace('"','(?:"|")').replace(/\s+/g,"\\s+")}function h(e,t){ var n,r;for(var i=0,a=t.length;in&&(a=i.exec(r[n]))){return a.index}return null}function v(e){if(l(t&&t.document)){return}var n=[t.location.href],r=t.document.getElementsByTagName("script"),i,o=""+e,a=/^function(?:\s+([\w$]+))?\s*\(([\w\s,]*)\)\s*\{\s*(\S[\s\S]*\S)\s*\}\s*$/,s=/^function on([\w$]+)\s*\(event\)\s*\{\s*(\S[\s\S]*\S)\s*\}\s*$/,u,f,p;for(var v=0;v]+)>|([^\)]+))\((.*)\))? in (.*):\s*$/i,i=t.split("\n"),o=[],a;for(var s=0;s=0){w.line=g+x.substring(0,_).split("\n").length}}}}else if(v=a.exec(n[y])){var T=t.location.href.replace(/#.*$/,"");var A=new RegExp(d(n[y+1]));var E=h(A,[T]);w={url:T,func:"",args:[],line:E?E.line:v[1],column:null}}if(w){if(!w.func){w.func=u(w.url,w.line)}var k=f(w.url,w.line);var S=k?k[Math.floor(k.length/2)]:null;if(k&&S.replace(/^\s*/,"")===n[y+1].replace(/^\s*/,"")){w.context=k}else{w.context=[n[y+1]]}l.push(w)}}if(!l.length){return null}return{mode:"multiline",name:e.name,message:n[0],stack:l}}function g(e,t,n,r){var i={url:t,line:n};if(i.url&&i.line){e.incomplete=false;if(!i.func){i.func=u(i.url,i.line)}if(!i.context){i.context=f(i.url,i.line); }var o=/ '([^']+)' /.exec(r);if(o){i.column=p(o[1],i.url,i.line)}if(e.stack.length>0){if(e.stack[0].url===i.url){if(e.stack[0].line===i.line){return false}else if(!e.stack[0].line&&e.stack[0].func===i.func){e.stack[0].line=i.line;e.stack[0].context=i.context;return false}}}e.stack.unshift(i);e.partial=true;return true}else{e.incomplete=true}return false}function b(e,t){var n=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,i=[],o={},s=false,l,f,c;for(var d=b.caller;d&&!s;d=d.caller){if(d===x||d===r.report){continue}f={url:null,func:a,args:[],line:null,column:null};if(d.name){f.func=d.name}else if(l=n.exec(d.toString())){f.func=l[1]}if(typeof f.func==="undefined"){try{f.func=l.input.substring(0,l.input.indexOf("{"))}catch(h){}}if(c=v(d)){f.url=c.url;f.line=c.line;if(f.func===a){f.func=u(f.url,f.line)}var m=/ '([^']+)' /.exec(e.message||e.description);if(m){f.column=p(m[1],c.url,c.line)}}if(o[""+d]){s=true}else{o[""+d]=true}i.push(f)}if(t){i.splice(0,t)}var y={mode:"callers", name:e.name,message:e.message,stack:i};g(y,e.sourceURL||e.fileName,e.line||e.lineNumber,e.message||e.description);return y}function x(t,n){var r=null;n=n==null?0:+n;try{r=y(t);if(r){return r}}catch(i){if(e){throw i}}try{r=m(t);if(r){return r}}catch(i){if(e){throw i}}try{r=w(t);if(r){return r}}catch(i){if(e){throw i}}try{r=b(t,n+1);if(r){return r}}catch(i){if(e){throw i}}return{mode:"failed"}}function _(e){e=(e==null?0:+e)+1;try{throw new Error}catch(t){return x(t,e+1)}}x.augmentStackTraceWithInitialElement=g;x.guessFunctionName=u;x.gatherContext=f;x.ofCaller=_;x.getSource=o;return x}();r.extendToAsynchronousCallbacks=function(){var e=function n(e){var n=t[e];t[e]=function i(){var e=o.call(arguments);var t=e[0];if(typeof t==="function"){e[0]=r.wrap(t)}if(n.apply){return n.apply(this,e)}else{return n(e[0],e[1])}}};e("setTimeout");e("setInterval")};if(!r.remoteFetching){r.remoteFetching=true}if(!r.collectWindowErrors){r.collectWindowErrors=true}if(!r.linesOfContext||r.linesOfContext<1){r.linesOfContext=11; }if(typeof e!=="undefined"&&e.exports&&t.module!==e){e.exports=r}else if(typeof define==="function"&&define.amd){define("TraceKit",[],r)}else{t.TraceKit=r}})(typeof window!=="undefined"?window:global)});define("shared/basicrpc",["shared/polyfills"],function f(require,exports,e){exports.rpc=function(e,n,r){n=t(n);var i=new XMLHttpRequest;i.onreadystatechange=function(){if(this.readyState===4&&this.status===200){if(r){r()}}};i.open("POST",e,true);i.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");i.setRequestHeader("Accept","*/*");i.send(n)};function t(e){var t=[];var r=function(e,n){t[t.length]=encodeURIComponent(e)+"="+encodeURIComponent(n)};for(var i in e){if(e.hasOwnProperty(i)){n(i,e[i],r)}}return t.join("&").replace(/%20/g,"+")}function n(e,t,r){if(t!==null&&typeof t==="object"){for(var i in t){if(t.hasOwnProperty(i)){n(e+"["+i+"]",t[i],r)}}}else{r(e,t)}}});define("shared/errors",["shared/polyfills","shared/errors","third_party/tracekit","shared/basicrpc"],function c(require,exports,e){ var t=require("third_party/tracekit"),n=require("shared/basicrpc").rpc;t.remoteFetching=false;t.collectWindowErrors=true;t.report.subscribe(a);var r=[];var i=s(u,1e3);exports.report=function(e){try{if(window.console){console.error(e.stack||e)}t.report(e)}catch(n){}};var o=function(e,n,o){var a=t.computeStackTrace.ofCaller();r.push({name:n,message:o,source:e,stack:a.stack||[]});i();console.error(o)};exports.logJsError=o.bind(null,"js");exports.logMobileJsError=o.bind(null,"mobile_js");exports.logJQueryError=o.bind(null,"jquery_js");function a(e){r.push(e);i()}function s(e,t){var n=false;return function(){if(n){return}n=true;setTimeout(function(){n=false;e()},t)}}function l(e){var t=[];for(var n=0;n=c?t():document.fonts.load(p(n,'"'+n.family+'"'),a).then(function(t){1<=t.length?e():setTimeout(r,25)},function(){t()})}r()});var m=new Promise(function(e,t){l=setTimeout(t,c)});Promise.race([m,v]).then(function(){clearTimeout(l);e(n)},function(){t(n)})}else r(function(){function r(){var t;if(t=-1!=y&&-1!=w||-1!=y&&-1!=g||-1!=w&&-1!=g)(t=y!=w&&y!=g&&w!=g)||(null===u&&(t=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent), u=!!t&&(536>parseInt(t[1],10)||536===parseInt(t[1],10)&&11>=parseInt(t[2],10))),t=u&&(y==b&&w==b&&g==b||y==x&&w==x&&g==x||y==_&&w==_&&g==_)),t=!t;t&&(null!==T.parentNode&&T.parentNode.removeChild(T),clearTimeout(l),e(n))}function f(){if((new Date).getTime()-h>=c)null!==T.parentNode&&T.parentNode.removeChild(T),t(n);else{var e=document.hidden;if(!0===e||void 0===e)y=d.a.offsetWidth,w=v.a.offsetWidth,g=m.a.offsetWidth,r();l=setTimeout(f,50)}}var d=new i(a),v=new i(a),m=new i(a),y=-1,w=-1,g=-1,b=-1,x=-1,_=-1,T=document.createElement("div");T.dir="ltr";o(d,p(n,"sans-serif"));o(v,p(n,"serif"));o(m,p(n,"monospace"));T.appendChild(d.a);T.appendChild(v.a);T.appendChild(m.a);document.body.appendChild(T);b=d.a.offsetWidth;x=v.a.offsetWidth;_=m.a.offsetWidth;f();s(d,function(e){y=e;r()});o(d,p(n,'"'+n.family+'",sans-serif'));s(v,function(e){w=e;r()});o(v,p(n,'"'+n.family+'",serif'));s(m,function(e){g=e;r()});o(m,p(n,'"'+n.family+'",monospace'))})})};"undefined"!==typeof e?e.exports=l:(window.FontFaceObserver=l, window.FontFaceObserver.prototype.load=l.prototype.load)})()});define("shared/webfont",["shared/polyfills","third_party/fontfaceobserver","shared/onload"],function g(require,exports,e){var t=require("third_party/fontfaceobserver"),n=require("shared/onload"),r="js-wf-loaded",i="wf-loaded",o=2e4;var a=function(e){var t=e||null;n.execAfterLoad(function(){window.require.whenReady("shared/cookies",function(){var e=require;var n=e("shared/cookies");n.setCookie(i,t,{expires:1})})})};var s=["q_serif",{style:"normal",weight:400}],l=["q_serif",{style:"normal",weight:"bold"}],u=["q_serif",{style:"italic",weight:400}],f=["q_serif",{style:"italic",weight:"bold"}],c=["q-icons",{}];var d={serif:[s,l,u,f,c]};function h(){return d.serif}function p(e){var n=h();var r=[];n.forEach(function(n){var i=n[0];var a=n[1];var s=i.indexOf("icon")!=-1?"":null;if(e.indexOf(i)!=-1){var l=new t(i,a);r.push(l.load(s,o))}});Promise.all(r).then(function(){v();var t=y(e);a(t)},function(){a(false)}).catch(function(){a(false); })}function v(){var e=g();if(e&&e.length==1&&e[0]=="q-icons"){return}var t=document.documentElement;t.classList.add(r)}function m(){return document.cookie.indexOf(i)!=-1}function y(e){return e&&e.join("-")}function w(e){var t=y(e);return document.cookie.indexOf(t)!=-1}function g(){return window.Q&&window.Q.fontFamilies||[]}function b(){var e=g();if(m()&&w(e)){v();p(e)}else{n.execAfterLoad(function(){p(e)})}}b()});require.whenReady(["shared/polyfills","shared/errors","shared/w2.timing","iesux","domain","redirect","shared/links","shared/onload","shared/webfont"],function(){require("shared/polyfills");require("shared/errors");require("shared/w2.timing");require("iesux");require("domain");require("redirect");require("shared/links");require("shared/onload");require("shared/webfont");require("shared/w2.timing").logTime("earlyScriptEnd")});